package com.echo.tagparse;

import java.util.LinkedList;

public class Stack<T> {
	private LinkedList<T> stack;
	
	public Stack(){
		stack = new LinkedList<T>();
	}
	
	public void push(T obj){
		stack.addFirst(obj);
	}
	
	public T peek(){
		if(!isEmpty()){
			return stack.getFirst();
		}else{
			return null;
		}
	}
	
	public T pop(){
		if(!isEmpty()){
			return stack.removeFirst();
		}else{
			return null;
		}
	}
	
	public boolean isEmpty(){
		return stack.isEmpty();
	}
}
